#-*- coding: utf-8 -*-
from django.db.models import *
from microblog.backend.models import Member
# Create your models here.

class Teacher(Model):
    GENDER_CHOICES = (
        (u'M',u'男'),
        (u'F',u'女'),
    )
    name = CharField(max_length=20)
    sex = CharField(max_length=10, choices=GENDER_CHOICES, blank=True)
    
    def __unicode__(self):
        return self.name


class Schedule(Model):
    TERM_CHOICES = (
        (u'1',u'第1学期'),
        (u'2',u'第2学期'),
    )
    year = IntegerField()
    term = CharField(max_length=10, choices=TERM_CHOICES)
    person = ForeignKey(Member)
    
    def __unicode__(self):
        return "%s,%s" % ( self.year, self.term)

class Course(Model):
    DAYSOFWEEK_CHOICES = (
        (u'1',u'星期一'),
        (u'2',u'星期二'),
        (u'3',u'星期三'),
        (u'4',u'星期四'),
        (u'5',u'星期五'),
        (u'6',u'星期六'),
        (u'7',u'星期天'),
    )
    SECTIONOFDAY_CHOICES =(
        (u'1',u'第一大节'),
        (u'2',u'第二大节'),
        (u'3',u'第三大节'),
        (u'4',u'第四大节'),
        (u'5',u'第五大节'),
        (u'6',u'第六大节'),
        (u'7',u'第七大节'),
    )
    name = CharField(max_length=30)
    teacher = ForeignKey(Teacher)
    classroom = CharField(max_length=20,blank=True)
    dayofweek = CharField(max_length=10, choices=DAYSOFWEEK_CHOICES)
    sectionofday = CharField(max_length=10, choices=SECTIONOFDAY_CHOICES)
    week = CharField(max_length=20)
    schedule = ForeignKey(Schedule)
    
    def __unicode__(self):
        return self.name
